//
//  BlockView.m
//  hexa
//
//  Created by kelly on 2014. 12. 31..
//  Copyright (c) 2014년 campmobile. All rights reserved.
//

#import "BlockView.h"

#define BLOCK_SIZE (43.0f)

@implementation BlockView

- (void)random
{
    BlockType firstBlock = arc4random() % 4 + 1;
    BlockType secondBlock = arc4random() % 4 + 1;
    BlockType thirdBlock = arc4random() % 4 + 1;
    
    if (!_firstBlock) {
        _firstBlock = [[BoardCell alloc] initWithFrame:CGRectMake(0, 0, BLOCK_SIZE, BLOCK_SIZE)];
        [self addSubview:_firstBlock];
    }
    [_firstBlock setTag:firstBlock];
    [BlockTypeUtil draw:firstBlock view:_firstBlock];
    
    if (!_secondBlock) {
        _secondBlock = [[BoardCell alloc] initWithFrame:CGRectMake(0, BLOCK_SIZE, BLOCK_SIZE, BLOCK_SIZE)];
        [self addSubview:_secondBlock];
    }
    [_secondBlock setTag:secondBlock];
    [BlockTypeUtil draw:secondBlock view:_secondBlock];
    
    if (!_thirdBlock) {
        _thirdBlock = [[BoardCell alloc] initWithFrame:CGRectMake(0, BLOCK_SIZE + BLOCK_SIZE, BLOCK_SIZE, BLOCK_SIZE)];
        [self addSubview:_thirdBlock];
    }
    [_thirdBlock setTag:thirdBlock];
    [BlockTypeUtil draw:thirdBlock view:_thirdBlock];
}

@end
